<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>XPDL Validator</title>
        <link rel="styleshee" type="text/css" href="XpdlValidatorStyles.css"/>
    </head>
    <body>
        <h1>XPDL Validation: Application</h1>
        <span id="form">
            <form enctype="multipart/form-data" onsubmit="submitButtonPressed()" >
                <script type="text/javascript" language="Javascript">
                    function makeHttpRequest()
                    {
                        if (typeof XMLHttpRequest != "undefined")
                        {
                            result = new XMLHttpRequest();
                        }
                        else
                        {
                            result = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        return result;
                    }
                    function submitButtonPressed()
                    {
                        var url = "./BackEnd?id=testing"
                        var request = makeHttpRequest();
                        request.open("GET", url, true);
                        
                        request.onreadystatechange = callback;
                        request.send(null);

                    }
                    function callback()
                    {
                        var test = 0;
                        test = test + 1;
                        alert("callback called: readyState=" + this.readyState + "; status=" + this.status);
                        if ((this.readyState == 4) && (this.status == 200))
                        {
                        }
                    }
                    function updateSubmitButton()
                    {
                        alert("updateSubmitButton called.");
                        button = document.getElementById("submit-button");
                        if (button)
                        {
                            fileEdit = document.getElementById("file-edit");
                            if (fileEdit)
                            {
                                if (fileEdit.valueOf() == "")
                                {
                                    button.setAttribute("enabled", "false");
                                }
                                else
                                {
                                    button.setAttribute("enabled", "true");
                                }
                            }
                        }
                    }
                    function showResults()
                    {
                        var results = document.getElementById("results");
                        results.style.display = "block";
                    }
                    function hideResults()
                    {
                        var results = document.getElementById("results");
                        results.style.display = "none";
                    }
                </script>
                <table border="0" width="54%" cellspacing="5">
                    <tr><td width="4%"></td>
                        <td width="96%"></td>
                    </tr>
                    <tr>
                        <td colspan="2">Choose an XPDL file for validation:</td>
                    </tr>
                    <tr>
                        <td colspan="2"><input name="fileName" type="file" size="60" id="file-edit" onchange="hideResults()"></input></td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input type="radio" name="Override" value="no">Do not alter the file before validating.</input>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input type="radio" name="Override" value="yes" checked>Alter to file to use these settings:</input>
                        </td>
                    </tr>
                    <tr>
                        <td/>
                        <td >Schema Version:
                            <input type=radio name="Schema Version" value="2.0">2.0</input>
                            <input type=radio name="Schema Version" value="2.1" checked>2.1</input>
                        </td>
                    </tr>
                    <tr>
                        <td/>
                        <td>Validation Level:
                            <input type=radio name="Validation Level" value="simple">Simple</input>
                            <input type=radio name="Validation Level" value="standard" checked>Standard</input>
                            <input type=radio name="Validation Level" value="complete">Complete</input>
                        </td>
                    </tr>
                    <tr>
                        <td/>
                        <td>
                        </td>
                    </tr>
                    <tr></tr>
                    <tr>
                        <td colspan="2" align="left">
                            <input type="submit" value="Upload and Validate" id="submit-button" onclick="submitButtonPressed()">
                        </td>
                    </tr>
                </table>
            </form>
        </span>
        <p>
            <a href="index.jsp">Return to the introduction</a>
        </p>
        <p>
            We welcome your suggestions.  You can send comments or bug reports to
            <a href="mailto:rshapiro@processanalytica.com?subject:XPDL Validator Web App Feedback">
                Robert Shapiro
            </a>
        </p>

    </body>
</html>
